﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using DBAccess;
using Logic;
using WHUT;

public partial class tokenTeam_index : System.Web.UI.Page
{
    private const int CHANNEL_ID = 1;    //..g 还待 确定 
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            BindGrid();
        }
    }

    /// <summary>
    /// 绑定到rptNews
    /// </summary>
    private void BindGrid()
    {
        //最新消息  //..g有待确定  name 
        DataTable dt = Common.SQLQueryAsDataTable(Common.GetDefaultDBConnection(), "SELECT TOP 10 [id],[title],[time_add],[channel_id] FROM [t_article] WHERE [channel_id] = CHANNEL_ID ORDER BY [time_add] ASC");
        rptNews.DataSource = dt;
        rptNews.DataBind();
    }

    protected string DateToString(Object dt)
    {
        try
        {
            DateTime dat = (DateTime)dt;
            return Convert.ToString(dat.Month) + "-" + Convert.ToString(dat.Day) + "-" + Convert.ToString(dat.Year);
        }
        catch 
        {
            return String.Empty;
        }
        
        //return String.Empty;
    }
}
